import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        ArrayList<String> huase=new ArrayList<String>();
        ArrayList<String> number=new ArrayList<String>();

        Collections.addAll(huase,"梅花","黑桃","方块","红桃");
        Collections.addAll(number,"A","2","3","4","5","6","7","8","9","10","J","Q","K");
        HashMap<String,String> pai = new HashMap<>();
        for (String i:huase) {
            for (String j:number) {
                pai.put(i,j);
            }
        }
        ArrayList<String> szjh = new ArrayList<String>();
        szjh.add("大王");
        szjh.add("小王");

        for (int i =0;i<=53;i++)
        {
            szjh.add(pai.get(i));
        }
        Collections.shuffle(szjh);
        ArrayList<String> PLAY1 = new ArrayList<String>();
        ArrayList<String> PLAY2 = new ArrayList<String>();
        ArrayList<String> PLAY3 = new ArrayList<String>();
        ArrayList<String> dipai = new ArrayList<String>();

        for (int i =0;i<=szjh.size();i++)
        {
            System.out.println(i);
            if (i>=szjh.size()-3){
                dipai.add(szjh.get(i));
            }else {
                if(i%3==0){
                    PLAY1.add(szjh.get(i));
                }else if(i%3==1){
                    PLAY2.add(szjh.get(i));
                }
                else if(i%3==2){
                    PLAY2.add(szjh.get(i));
                }
            }
        }
        Collections.sort(PLAY1);
        Collections.sort(PLAY2);
        Collections.sort(PLAY3);
        look("play1",PLAY1);
        look("play2",PLAY2);
        look("play3",PLAY3);
    }
    public static void look(String name,ArrayList<String> arr){
        System.out.println(name+"的牌是：");
        for (String i:arr) {
            System.out.println(i+" ");

        }
        System.out.println();
    }
}